package com.spring.demo2.entity;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.ApplicationContext;

import java.util.Arrays;

@Configurable
public class MyBean {
    @Autowired
    private ApplicationContext applicationContext;

    private String name;

    @Override
    public String toString() {
        return Arrays.asList(applicationContext.getBeanDefinitionNames()).toString();
    }

    public MyBean() {
    }

    public MyBean(String name) {
        this.name = name;
    }

    public ApplicationContext getApplicationContext() {
        return applicationContext;
    }

    public void setApplicationContext(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
